package com.aaa.controller;

import com.aaa.service.impl.NettyPushServerImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javafx.geometry.Pos;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "通知接口")
@CrossOrigin
@RequestMapping("netty")
public class NettyController {
    @Autowired
    NettyPushServerImpl pushServer;



    @ApiOperation("在线人全部通知")
    @RequestMapping(value = "pushall",method = RequestMethod.POST)
    public void pushAll(@ApiParam("通知内容") String msg){
        pushServer.pushAllServer(msg);
    }

    @ApiOperation("单点通知")
    @RequestMapping(value = "pushone",method = RequestMethod.POST)
    public void pushone(@ApiParam("被通知人的id") String id,@ApiParam("通知内容") String msg){
        pushServer.pushidServer(id,msg);
    }

    @ApiOperation("发布订阅")
    @RequestMapping(value = "push",method = RequestMethod.POST)
    public void push(@ApiParam("发布者的id") Integer id,@ApiParam("发布的内容") String msg){
    pushServer.push(id,msg);
    }
}
